public class Homework {
    public static void main(String[] args) {
        int n = 100;
        int result = sum(n);
        System.out.println("1 到 100 的和为: " + result);
    }
    public static int sum(int n) {
        if (n == 1) {
            return 1;
        }
        return n + sum(n - 1);
    }
}
